#ifndef LIB_H
#define LIB_H

#ifdef __cplusplus
extern "C" {
#endif

#define EXP32

#ifdef __cplusplus
#  define __BEGIN_DECL		extern "C" {
#  define __END_DECL		}
#else
#  define __BEGIN_DECL
#  define __END_DECL
#endif

typedef signed char			int8;
typedef signed short		int16;
typedef signed long			int32;

typedef unsigned char		uint8;
typedef unsigned short		uint16;
typedef unsigned long		uint32;

typedef unsigned char		bool8;

#ifndef __DEBUG_H
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#define true				((bool8)1)
#define false				((bool8)0)
#endif

#ifdef DEBUG
#	if (_MSC_VER >= 800)
#		define breakpt()	__asm { int 3 }
#	else
#		define breakpt()
#	endif
#	ifdef USE_NTSERVICE
#		define DEBUGMSG(x)
#		define ASSERT(x)
#	else
#		include <stdio.h>
#		define DEBUGMSG(x)	{printf##x; printf("\n"); }
#		undef ASSERT
#		define ASSERT(x)	if (!(x)) { DEBUGMSG(("ASSERT FAILED: %s  (%s,%d)",\
							#x, __FILE__, __LINE__)); breakpt(); }
#	endif
#else
#	define DEBUGMSG(x)
//	DO NOT define "breakpt()" here...it should NEVER show up in production code!
#endif

#ifndef ABS
#define ABS(x)					((x) < 0 ? -(x) : (x))
#endif

#ifndef MAX
#define MAX(x,y)				((x) > (y) ? (x) : (y))
#endif

#ifndef MIN
#define MIN(x,y)	((x) < (y) ? (x) : (y))
#endif

// to avoid having the world depend on windows.h
#ifndef _WINDOWS_
	typedef void *PVOID, *LPVOID;    
	typedef unsigned int UINT;
	typedef PVOID HANDLE;
	typedef PVOID HINSTANCE;
	typedef HANDLE HWND;
	typedef HANDLE HDC;
	typedef HANDLE HBITMAP;
	typedef HANDLE HPALETTE;
	typedef long LONG;
	typedef char CHAR;
	typedef int BOOL;
	typedef unsigned char BYTE;
	typedef unsigned short WORD;
	typedef unsigned short WCHAR;
	typedef CHAR *LPSTR;
	typedef UINT WPARAM;
	typedef LONG LPARAM;
	typedef const CHAR *LPCSTR;
	typedef unsigned long DWORD;
	typedef struct _RTL_CRITICAL_SECTION *PCRITICAL_SECTION;
	typedef struct _OVERLAPPED *LPOVERLAPPED;
	typedef struct tagPALETTEENTRY {
		BYTE        peRed;
		BYTE        peGreen;
		BYTE        peBlue;
		BYTE        peFlags;
	} PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;
	typedef struct tagRGBQUAD {
		BYTE    	rgbBlue;
		BYTE    	rgbGreen;
		BYTE    	rgbRed;
		BYTE    	rgbReserved;
	} RGBQUAD;
	typedef struct tagLOGPALETTE {
		WORD        palVersion;
		WORD        palNumEntries;
		PALETTEENTRY        palPalEntry[1];
	} LOGPALETTE;

#	if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#		define CALLBACK    __stdcall
#		define WINAPI      __stdcall
#	else
#		define CALLBACK
#		define WINAPI
#	endif
#endif

#ifndef _WINSOCKAPI_		// to avoid having the world depend on winsock.h
	typedef unsigned int    u_int;
	typedef u_int           SOCKET;
	typedef struct sockaddr SOCKADDR;
	typedef struct sockaddr_in SOCKADDR_IN;
#endif

#define PLIBEXP
typedef struct _CStream* pCStream;

#ifdef __cplusplus
}
#endif

#endif

#ifndef CASBASE_H
#define CASBASE_H

class CasinoBase
{
	public:
		static void load();
        static void getStrOpt(char*, char*, char*, char*, int32, char*);
        static void getStrOptEx(char*, char*, char*, char*, int32);
		static int  setStrOptEx(char*, char*, char*);

		static int32 getInt32Opt(char*, char*, int32, char*);
		static int32 getInt32OptEx(char*, char*, int32);

	protected:
		static int32 strip(char*, int32);

	public:
		static char	basename[20];
		static int32 baseport;
};

#endif
